﻿CREATE PROCEDURE [acms].[TemplateFile_Delete]
	@Id int, 
	@VersionId timestamp
AS

	if exists (Select null from TemplateFile_View where Id = @Id) begin
		update TemplateFiles
		set
			Deleted = 1
		where Id = @Id
			and VersionId = @VersionId
			and Deleted = 0
		if @@rowcount = 0
			return -100
		else
			return 0
	end
	else
		return -200
